set curDir=%cd%
set appDir=%curDir%\..\..\..
set newJar=%appDir%\DCEdit.jar
set jarManifest=%curDir%\manifest.txt
set libDir=%appDir%\lib\*
REM NETBEANS set binDir=%appDir%\build\classes\*
REM ECLIPSE
set binDir=%appDir%\bin\*
set tempDir=%appDir%\PostCompileTemp

echo Creating temporary directory.
rmdir /S /Q "%tempDir%"
mkdir "%tempDir%"

echo Changing location to temporary directory.
cd "%tempDir%"

echo Unpacking JAR files.
for %%f in ("%libDir%") do jar xvf "%%f"

echo Copying appliation classes to temporary directory.
xcopy "%binDir%" /E

REM echo Copying resources to temporary directory.
REM xcopy "%curDir%" /E

echo Removing existing DCEdit.jar file.
del "%newJar%"

echo Packing JAR contents into single file.  This may take a few minutes.
jar cfm "%newJar%" "%jarManifest%" com dcedit META-INF org resource sun tools img templates Looks.license Quaqua.license Substance.license XUI.license

echo Removing temporary directory.
cd "%appDir%"
rmdir /S /Q "%tempDir%"

pause